﻿using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Text;
using NUnit.Framework;
using SureKAM.BackUp.Notify.DataAccess;
using System.Xml;

namespace SureKAM.BackUp.Noitfy.DataAccess.Test
{
    public class XMLHelperTestFixture
    {
        private XMLHelper _xmlHelper = null;


        [TestFixtureSetUp]
        public void TestFixtureSetUp()
        {
            this._xmlHelper = new XMLHelper(Environment.CurrentDirectory + "\\" + System.Configuration.ConfigurationSettings.AppSettings["DirectoryFile"].ToString());
        }

        [Test]
        public void GetNodesTest()
        {
            List<Notify.Domain.Notify> notifies= this._xmlHelper.GetNodes<Notify.Domain.Notify>();
            Assert.IsNotNull(notifies);
        }

        [Test]
        public void SaveToFileTest()
        {
            List<Notify.Domain.Notify> notifies = new List<Notify.Domain.Notify>
                                                      {
                                                          new Notify.Domain.Notify{ID=new Guid().ToString(),Email = "wuhong@surekam.com",Name = "吴红"}
                                                      };
            bool operation = this._xmlHelper.SaveToFile<Notify.Domain.Notify>(notifies);
            Assert.IsTrue(operation);
        }
    }
}
